package cn.edu.lingnan.servlet.project;



import cn.edu.lingnan.pojo.ProjectAdult;
import cn.edu.lingnan.service.ProjectService;
import cn.edu.lingnan.service.ProjectServiceImp;

import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/adultproject")
public class ApproveProjectServlet extends HttpServlet {
    private ProjectService projectService= new ProjectServiceImp();

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        response.setCharacterEncoding("UTF-8");
         Integer projectId =Integer.parseInt( request.getParameter("projectId"));
        String studentName = request.getParameter("studentName");

        Integer i = projectService.AgreeEnterProject(projectId, studentName);
        List<ProjectAdult> projectAdults = projectService.queryaduitProject();
       request.getSession().setAttribute("projectAdults",projectAdults);

        response.sendRedirect("manager_projectAudits.jsp");  // replace with your JSP page path
    }
}

